package ictbk.ttmk51.grapro.app.utils;

import java.io.ByteArrayOutputStream;
import java.io.IOException;

import android.graphics.Bitmap;

public class BitmapStringBase64 {
	public static String BitmaptoStringBase64(Bitmap bitmap){
		ByteArrayOutputStream bao = new ByteArrayOutputStream();
		Bitmap bm = bitmap;
		bm.compress(Bitmap.CompressFormat.JPEG, 90, bao);
		byte[] ba = bao.toByteArray();
		String base64 = Base64.encodeBytes(ba);
		return base64;
	}
	public static byte[] StringBase64toBitmap(String stringBase64){
		byte[] result = null;
		try {
			result = Base64.decode(stringBase64);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return result;
	}
}
